<?php

namespace App\Http\Controllers;

use App\Post;

use App\Http\Requests;
use Cache;
use Illuminate\Support\Facades\Input;
use Session;

class PostController extends Controller
{
	/**
	 * Display a listing of the resource.
	 *
	 * @return Response
	 */
	public function index()
	{
		Cache::add('test', ['test', '888'], 100);
		print_r(Cache::get('test'));
		return view('post.index', ['posts'=>Post::all()]);
	}

	/**
	 * Show the form for creating a new resource.
	 *
	 * @return Response
	 */
	public function create()
	{
		return view('post.create', ['url' => asset('createPost')]);
	}

	/**
	 * Store a newly created resource in storage.
	 *
	 * @return Response
	 */
	public function store()
	{
		$post          = new Post;
		$post->title   = Input::get('title');
		$post->content = Input::get('content');
		$post->save();

	}

	/**
	 * Display the specified resource.
	 *
	 * @param  int $id
	 * @return Response
	 */
	public function show($id)
	{
		$post = Post::findOrNew($id);
		return view('post.show', ['post' => $post]);
	}

	/**
	 * Show the form for editing the specified resource.
	 *
	 * @param  int $id
	 * @return Response
	 */
	public function edit($id)
	{
		//
	}

	/**
	 * Update the specified resource in storage.
	 *
	 * @param  int $id
	 * @return Response
	 */
	public function update($id)
	{
		//
	}

	/**
	 * Remove the specified resource from storage.
	 *
	 * @param  int $id
	 * @return Response
	 */
	public function destroy($id)
	{
		//
	}
}
